package com.dearbinge.pay.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections.map.HashedMap;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;


public class test {

	public static void main1(String[] args) {

		String string = "{'list': [{'commodityId': '219_5','isDistribution': 0,'price': 3599,'shopId': 24,'shopName': '孙行者数码官方旗舰店'},{'commodityId': '219_5','isDistribution': 0,'price': 3599,'shopId': 24,'shopName': '孙行者数码官方旗舰店'},{'commodityId': '306_1','isDistribution': 0,'price': 768,'shopId': 21,'shopName': '欧欧'}]}";
//		String string = '[{commodityId: '219_5',isDistribution: 0,price: 3599,shopId: 24,shopName: '孙行者数码官方旗舰店'},{commodityId: '219_5',isDistribution: 0,price: 3599,shopId: 24,shopName: '孙行者数码官方旗舰店'},{commodityId: '306_1',isDistribution: 0,price: 768,shopId: 21,shopName: '欧欧'}]';
		try {
			JSONObject parseObject = JSON.parseObject(string);
			com.alibaba.fastjson.JSONArray OrderTableDtoList = JSON.parseArray(parseObject.getString("list"));
			Map map = new HashedMap();
			for(int i=0;i<OrderTableDtoList.size();i++){
					Map object = (Map) OrderTableDtoList.get(i);
//					for(int j=0;j<OrderTableDtoList.size();j++){
//						Map map1 = (Map) OrderTableDtoList.get(j);
//						String shopId = (String) object.get("shopId");
//						if(shopId.equals(map1.get("shopId"))){
//
//						}
//					}
					map.put(object.get("shopId"), object);
			}
//			System.out.println(OrderTableDtoList);
			System.out.println(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
